package team.xstudio.bedwarstoolkit.utils

import net.minecraft.resources.ResourceLocation
import net.minecraft.server.MinecraftServer
import net.minecraft.world.level.Level
import net.minecraftforge.fml.ModList
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import team.xstudio.bedwarstoolkit.BedWarsToolkit
import team.xstudio.bedwarstoolkit.misc.BWLevels

/**
 * Created in 2025/6/10
 * Project: bedwarstoolkit
 *
 * @author <a href="https://github.com/Bread-Nicecat">Bread_NiceCat</a>
 * <p>
 *
 * <p>
 **/
object BWUtils {

    val LOGGER: Logger = LoggerFactory.getLogger(BedWarsToolkit.MOD_NAME)

    fun prefix(path: String): ResourceLocation = prefix(BedWarsToolkit.MOD_ID, path)

    fun prefix(modid: String, path: String): ResourceLocation =
        ResourceLocation.fromNamespaceAndPath(modid, path)

    fun isLoaded(modid: String): Boolean = ModList.get().isLoaded(modid)

    fun Level.isInSkyLevel() = BWLevels.isInSkyLevel(this)
    fun MinecraftServer.getSkyLevel() = getLevel(BWLevels.SKY_LEVEL)!!
}